package com.base.cn.platform.os.service.course.cou.record;

import com.base.cn.platform.os.entity.course.cou.record.CourseLearnFlow;
import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.course.CourseBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 课程学习记录流水
 *
 * @author zjh
 * @since 2018-12-14
 **/
@FeignClient(value = CourseBaseService.appName, configuration = FeignAuthConfig.class)
public interface CourseLearnFlowService extends CourseBaseService {
    /**
     * 保存课程学习记录流水
     * @param courseLearnFlow
     * @return
     */
    @RequestMapping(contextPath+"/saveCourseLearnFlow")
     Map<String,Object> saveCourseLearnFlow(@RequestBody Map<String, Object> courseLearnFlow, @RequestParam(value = "finish", required = false, defaultValue = "1") Integer finish);

    /**
     * 查询课程播放记录列表
     *
     * @param params  课程播放记录查询条件
     * @param currentPage 页码
     * @param pageSize 查询数量
     * @return 课程播放记录列表zxcx
     */
    @RequestMapping(contextPath +"/queryCoursePlayDetailPage")
    Map<String,Object>  queryCoursePlayDetailPage(@RequestBody Map<String, Object> params,
                                                  @RequestParam(value = "currentPage") int currentPage,
                                                  @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize, @RequestParam(value = "setCourse") boolean setCourse, @RequestParam(value = "setCatalogData") boolean setCatalogData);


    /**
     * 查询某个时间点用户的学习记录（用于生成折线图）
     *
     * @param params  课程播放记录明细查询条件
     * @return
     */
    @RequestMapping(contextPath +"/selectLearnTimeMap")
    List<Map<String,Object>> selectLearnTimeMap(@RequestBody Map<String, Object> params);

    /**
     * 查询某个时间点用户的学习时间
     *
     * @param params  课程播放
     *                记录明细查询条件
     * @return
     */
    @RequestMapping(contextPath +"/selectOneDayTime")
    Integer selectOneDayTime(@RequestBody Map<String, Object> params);


        /**
         * 查询课程播放记录列表
      * @param params  课程播放记录查询条件
     * @param currentPage 页码
     * @param pageSize 查询数量
     * @param setCourse  设置课程
     * @param setCreator 设置前台用户
     * @param setCatalogData 是否设置目录数据
     * @param setCatalogTeacher 是否设置目录讲师
     * @return 课程播放记录列表zxcx
     */
    @RequestMapping(contextPath +"/findCoursePlayRecordFlowPage")
    Map<String,Object>  findCoursePlayRecordFlowPage(@RequestBody Map<String, Object> params,
                                                     @RequestParam(value = "currentPage") int currentPage,
                                                     @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize,
                                                     @RequestParam(value = "setCourse") boolean setCourse,
                                                     @RequestParam(value = "setCreator") boolean setCreator,
                                                     @RequestParam("setCatalogData") boolean setCatalogData,
                                                     @RequestParam("setCatalogTeacher") boolean setCatalogTeacher);


    /**
     * 根据素材id获取当天视频学习记录
     * @param materialId 视频素材id
     * @return
     */
    @RequestMapping(contextPath+"/findCourseLearnFlowByMaterialId")
    List<CourseLearnFlow> findCourseLearnFlowByMaterialId(@RequestParam("materialId") BigDecimal materialId);


    /**
     * 查询课程播放记录列表
     * @param params  课程播放记录查询条件
     * @param currentPage 页码
     * @param pageSize 查询数量
     * @return 课程播放记录列表zxcx
     */
    @RequestMapping(contextPath +"/findCoursePlayRecordPracticeFlowPage")
    Map<String,Object>  findCoursePlayRecordPracticeFlowPage(@RequestBody Map<String, Object> params,
                                                     @RequestParam(value = "currentPage") int currentPage,
                                                     @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize);


    /**
     * 查询用户的学习记录（用于生成折线图）
     *
     * @param condition  时间条件 {type 1 日 2 月 3 年 startTime 开始时间 endTime结束时间}
     * @return 课程播放记录列表
     */
    @RequestMapping(contextPath +"/selectLearningTrend")
     List<Map<String,Object>> selectLearningTrend(@RequestBody  Map condition);

}
